using System;
using System.Numerics;

namespace ProjectEuler.Core
{
    public class Problem20 : IProjectEulerProblem
    {
        protected string Factorialof(int n)
        {
            var fac = new BigInteger(n);
            for(int i=(n-1);i>0;i--)
            {
                fac = fac*i;
            }
            return fac.ToString();
        }

        protected int SumOfDigits(string digits)
        {
            int Sum = 0;
            for (int x = 0; x < digits.Length; x++)
            {
                Sum += Int32.Parse(digits.Substring(x, 1));
            }
            return Sum;
        }

        public int Number
        {
            get { return 20; }
        }

        public string Description
        {
            get { return "Find the sum of the digits in the number 100!"; }
        }

        public string Answer
        {
            get { return SumOfDigits(Factorialof(100)).ToString(); }
        }
    }
}